package com.bingfor.easycablelink.product;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.bingfor.easycablelink.base.BaseFragment;
import com.bingfor.easycablelink.databinding.LogisticalPageBinding;
import com.bingfor.easycablelink.home.Fragment.logistical.LogisticalItemAdapter;
import com.bingfor.easycablelink.utils.ToastUtil;
import com.bingfor.easycablelink.widgets.RefreshableView;


/**
*配套详情底部切换Fragment
*@author LY
*@time 2017/5/26 17:47
* des:create file and achieve model
*/
public class QuotationPage extends BaseFragment implements RefreshableView.PullToRefreshListener {

    LogisticalPageBinding binding ;
    QuotationItemAdapter adapter = new QuotationItemAdapter();
    public RecyclerView.LayoutManager mLayoutManager = null;
    int page;

    public QuotationPage(int page) {
        this.page = page;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        binding = LogisticalPageBinding.inflate(inflater, container, false);
        return binding.getRoot();
    }

    @Override
    public void onActivityCreated( Bundle savedInstanceState ){
        super.onActivityCreated(savedInstanceState);
        initViews();
    }

    @Override
    public void refresh() {

    }

    @Override
    public void initViews() {

        binding.mRecyclerView.setLayoutManager(new GridLayoutManager(mContext, 2));
        binding.mRecyclerView.setAdapter(adapter);
//        binding.mRecyclerView.addItemDecoration(new MarginDecoration(0, 0, (int) getResources().getDimension(R.dimen.dimen_5dp), 0));
//            SnapHelper snapHelper = new GravitySnapHelper(Gravity.START);
//            snapHelper.attachToRecyclerView(mRecyclerView);


    }

    @Override
    public void initToolbar() {

    }

    public static QuotationPage getInstance(int Page) {


        return new QuotationPage(Page);
    }

    @Override
    public void onRefresh() {
        ToastUtil.showToast("start");

    }
}
